package com.oceantrader.sale.commons.vertx;

import org.springframework.stereotype.Component;

import io.vertx.core.AbstractVerticle;
import io.vertx.ext.web.Router;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * Web配置
 * 
 * @author xuesinuo
 */
@Slf4j
@Component
@RequiredArgsConstructor
public class WebVerticle extends AbstractVerticle {
    private final Router router;

    @Override
    public void start() {
        vertx.createHttpServer()
                .requestHandler(router)
                .listen(8080)
                .onSuccess(hs -> {
                    log.info("Vert.x run on port: " + hs.actualPort());
                });
    }
}
